﻿using System;

namespace ZyGame
{
    public sealed class FloatVarable : Varable<float>
    {
        public FloatVarable(float value)
        {
            this.value = value;
        }

        public static implicit operator float(FloatVarable varable)
        {
            return varable.value;
        }

        public static explicit operator FloatVarable(float varable)
        {
            return new FloatVarable(varable);
        }

        public static FloatVarable operator +(FloatVarable left, FloatVarable right)
        {
            left.value = Math.Clamp(left.value + right.value, int.MinValue, int.MaxValue);
            return left;
        }

        public static FloatVarable operator -(FloatVarable left, FloatVarable right)
        {
            left.value = Math.Clamp(left.value - right.value, int.MinValue, int.MaxValue);
            return left;
        }

        public static FloatVarable operator *(FloatVarable left, FloatVarable right)
        {
            left.value = Math.Clamp(left.value * right.value, int.MinValue, int.MaxValue);
            return left;
        }

        public static FloatVarable operator /(FloatVarable left, FloatVarable right)
        {
            left.value /= right.value;
            return left;
        }

        public static bool operator ==(FloatVarable left, FloatVarable right)
        {
            return left.value == right.value;
        }

        public static bool operator !=(FloatVarable left, FloatVarable right)
        {
            return left.value != right.value;
        }
    }
}
